#!/usr/bin/env python
import sys

def chartmyheart(*omhe_dict_list):
    
    url_stub = "http://chart.apis.google.com/chart?cht=ls&chd=t:"
    url_end ="chxt=x,y&chxr=0,date1,date2,date3,date4|1,0,200&chs=200x125"
    #print omhe_dict_list
    j=0;
    for i in omhe_dict_list:
        
        print "arg-> %s name-> %s value-> %s" % (i,  omhe_dict_list[j]['name'], omhe_dict_list[j]['value'])
        url_stub= url_stub + ",%s" %  (omhe_dict_list[j]['value'])
        j=j+1;
    #for key in kwargs:
    #    
    #    print "%s: %s" % (key, kwargs[key])
    #
    #    url_stub=",%s" % (kwargs[value])
    print url_stub


if __name__ == "__main__":
    
        try:
            tag_tuple =()
            omhe_dict ={}
            omhe_dict_list=[]
            
            inputfilename = sys.argv[1]
            input = open(inputfilename,'r')
            while 1:
                line = input.readline()
                if not line: break
                splitline = line.split('|')
                
                #omhe_dict['date']=splitline[0]
                currentdate=splitline[0]
                
                command = splitline[1]
                command = command.rstrip("\n")
                omhe_dict['command']=command
                
                splitcommand=splitline[1].split('wt')
                
                
                omhe_dict['name']='wt'
                
                #omhe_dict['value']=splitcommand[1]
                
                splittags = splitcommand[1].split('#')
                
                
                value=splittags[0]
                value = value.rstrip("\n")
                omhe_dict['value']=value
                
                for tag in splittags[1:len(splittags)]:
                    #print tag
                    #
                    tag_tuple = tag_tuple + (tag,)
                 
                omhe_dict['tags']=tag_tuple
                
                omhe_dict['command'] = omhe_dict['command'].rstrip("\n")
                #omhe_dict['name'] = omhe_dict['name'].str.rstrip("\n")
                #omhe_dict['value'] = omhe_dict['value'].sstr.rstrip("\n")
                #omhe_dict['tags'] = omhe_dict['tags'].str.rstrip("\n")
                
                #print splitline
                #print "processing for date: $s" % currentdate
                #print "hello"
                omhe_dict_list = omhe_dict_list + [omhe_dict]
                #reset variables
                omhe_dict={}
                tag_tuple=()
                splittags=()
            
            chartmyheart(*omhe_dict_list)    
             
        except:
            print "There was an error getting the command line arguments."
            print "USAGE: charmyheart.py [inputfile] "
            print sys.exc_info()
            exit(1)
                
        try:
            #kwargs = {date1:bp1, date2:bp2, date3:bp3}
            #chartmyheart(**kwargs)
            pass
        except:
            print "There was an error executing chartmyheart function."
            print sys.exc_info()